import { shallowRef } from 'vue';

export function useActivityHooks ({
  ref,
  resetCallbck
}) {
  function addActivity () {
    if (ref.value) {
      ref.value.open(null, false)
    }
  }
  function editActivity (id) {
    if (ref.value) {
      ref.value.open(id, false)
    }
  }
  function visitActivity (id) {
    if (ref.value) {
      ref.value.open(id, true)
    }
  }
  function reset () {
    if (ref.value) {
      ref.value.close()
    }
    resetCallbck()
  }
  return {
    addActivity,
    editActivity,
    visitActivity,
    reset,
  }
}